package com.tarry.controller;

import com.tarry.common.Result;
import com.tarry.exception.AppException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class TestController {

    @RequestMapping("/hello.json")
    public Result hello(){

        return Result.success("Hello world");
}

    @RequestMapping("appeception.json")
    public Result appException(){
        throw new AppException("AppException");
    }

    @RequestMapping("unknow.json")
    public void unknowExcption(){
        throw new RuntimeException();
    }
}
